package cn.clickmed.getActivity;

import org.apache.cordova.CordovaActivity;
import org.apache.cordova.LOG;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.inputmethod.InputMethodManager;
import cn.clickmed.DaTong.R;
import cn.clickmed.exitApp.SysApplication;

import com.baidu.push.example.MyPushMessageReceiver;

public class getActivity extends CordovaActivity {
	public void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		super.init();
		getIntent().putExtra("splashscreen", R.drawable.datong_db_bg);
		InputMethodManager im = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
		im.hideSoftInputFromWindow(getCurrentFocus().getApplicationWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);

		Intent tempI = getIntent();
		Bundle extras = tempI.getExtras();
		String url = extras.getString("url");
		LOG.e("url", url);
		// Clear events count after notification clicked!
		if (tempI.getExtras() != null) {
			Object businessType = tempI.getExtras().get("businessType");
			if (businessType != null && businessType.toString().length() > 0)
				MyPushMessageReceiver.messageMap.remove(businessType.toString());
		}
		// Set by <content src="index.html" /> in config.xml
		super.loadUrl(url);
		// super.loadUrl("file:///android_asset/www/index.html");
		 SysApplication.getInstance().addActivity(this); 

	}

	@Override
	protected void onNewIntent(Intent intent) {

		Intent tempI = getIntent();
		Bundle extras = tempI.getExtras();
		String url = extras.getString("url");
		LOG.e("url", url);
		// Clear events count after notification clicked!
		if (intent.getExtras() != null) {
			Object businessType = intent.getExtras().get("businessType");
			if (businessType != null && businessType.toString().length() > 0)
				MyPushMessageReceiver.messageMap.remove(businessType.toString());
		}
		// Set by <content src="index.html" /> in config.xml
		super.loadUrl(url);
	}

	public void onActivityResult(Intent intent, int resultCode) {
		System.out.print("resultCode" + resultCode);
		if (resultCode == -1) {
			finish();
		}
	}

/**	
	@Override  
    protected CordovaWebViewClient makeWebViewClient(CordovaWebView webView) {  
        // TODO Auto-generated method stub  
         if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {  
                return new SSLAcceptingCordovaWebViewClient(this, webView);  
            } else {  
                return new SSLAcceptingIceCreamCordovaWebViewClient(this, webView);  
            }  
    }  
*/
}

